<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html class="no-js">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<%@ include file="../../include.jsp" %> 
<%-- <%@ include file="../../mobilehead_inc.jsp" %> --%>
<script src="${ctx }/mobile/js/jquery.min.js"></script>
<script type="text/javascript" src="${ctx }/js/pay.js"></script>
<%-- <script type="text/javascript" src="${ctx }/js/wxpay.js"></script> --%>
<link href="${ctx }/css/pay.css" rel="stylesheet" type="text/css">
<title>购物</title>
<script type="text/javascript">
var _orderInfo;
$(document).ready(function()
		{
			// 获取要购买的商品信息	
			params = GetUrlParams(window.location.href);
			//console.log(decodeURIComponent(params.OrderInfo));
			orderInfo = JSON.parse(decodeURIComponent(params.OrderInfo));
			console.log(orderInfo);
			_orderInfo = JSON.stringify(orderInfo);
			console.log(_orderInfo.length);
			DisplayOrderInfo(orderInfo);	
		});
		
function CommitOrder(){
	
	$.ajax({
        url: '${ctx}/mobile/commitOrder',
        type : "POST",
        dataType: "json",
       // async: true,
        data:{
        	token : getCookie('USER_TOKEN'),
        	orderDeatil : _orderInfo
       
        },
        success: function (result) {
        	console.log(result);
        	//console.log(result.obj.address);
        	if(result.success == 3){
        		
        		ShowTip("请把个人信息（收货地址）填写完整", 110);
        	}
        	else if(result.success == 0) {
				window.location.href = "${ctx }/mobile/successOrder";
				for (var i=0; i<orderInfo.length; i++)
				{		
					RemoveCart(orderInfo[i].commodityId);
				}				
			}else{
				ShowTip("下单失败！请再试一次");
			}
        	        	
        },
        error: function () {
        	
        }
        
    });	
	
	
	
	
}

</script>
</head>

<body>
	<div class="title">
    	<button onclick="history.go(-1);"></button>
       <!--  <a>返回</a> -->
    </div>
    <div id="order_info">
    	<div id="order_title">
        	<a>订单信息</a>
        </div>
        <div id="order_detail">
        	
        </div>
    </div>
    
    <div id="pay_type">
    	<div id="pay_type_title">
        	<a>选择支付方式</a>
        </div>
        <%-- <div id="pay_type_detail">
        	<div class="pay_type_item">
            	<img src="${ctx }/images/pay_type_wechat.png">
                <a>微信支付</a>
            </div>
        </div> --%>
        <div class="am-radio">
			<label> <input type="radio" name="payWay" value="2"
				checked>
				<!--  <img src="/mobile/images/zsq.png" width="30"
				height="30"> -->
				 <span style="font: normal; font-size: 15px; color: gray;">货到付款</span>
			</label>
		</div>

		<div class="am-radio">
			<label> <input type="radio" name="payWay"
				disabled="disabled" value="1"><%-- <img
				src="${ctx }/images/pay_type_wechat.png" width="30" height="30"> --%> <span
				style="font: normal; font-size: 15px; color: gray;">微信支付(暂未开通)</span>
			</label>
		</div>
        <!--  <div class="am-radio">
			<label> <input type="radio" name="payWay"
				disabled="disabled" value="1"><img
				src="/mobile/images/zhifubao.jpg" width="30" height="30"> <span
				style="font: normal; font-size: 15px; color: gray;">支付宝支付(暂未开通)</span>
			</label>
		</div> -->
    </div>
    
    <div id="pay_commit">
    	<a id="pay_count">共 <strong>0</strong> 件商品</a>
        <button onclick="CommitOrder();">提交订单</button>
        <div id="pay_amount">合计：<a>￥ <strong>0.00</strong></a></div>
    </div>
</body>
</html>